Ext.define('PC.view.ativos.ListaAtivos' ,{
    extend: 'Ext.grid.Panel',
    alias : 'widget.listaAtivos',
    title : 'List of Customers',
//    store : 'StoreAtivos',
    loadMask: true,
    
    columns : [{
        header: 'Cod', 
        dataIndex: 'codigo',
        flex: 1,
    }, {
        header: 'Ativo',
        dataIndex: 'ativo',
        flex: 1,
        editor: {
            allowBlank: false
        }
    }, {
        header: 'Preco',
        dataIndex: 'preco',
        flex: 1,
        editor: {
            allowBlank: false
        }
    }, {
        header: 'Osc %', 
        dataIndex: 'oscilacao', 
        flex: 1
    }, {
        header: 'Data/Hora', 
        dataIndex: 'datahora', 
        flex: 1
    }, {
		xtype : 'actioncolumn',
		width : 50,
		items : [ {
			icon : 'resources/images/16x16/edit.png',
			tooltip : 'Detalhes',
			id : 'detalhes',
			action : 'showDetalhes',
			handler: function(view, rowIndex, colIndex, item, e) {
                this.fireEvent('itemclick', this, 'sell', view, rowIndex, colIndex, item, e);
            },
			/*handler : function(grid, rowIndex, colIndex) {
				var rec = grid.getStore().getAt(rowIndex);
				rowEditing.startEdit(rec, colIndex);
//				Ext.MessageBox.alert('Edit', rec.get('book'));
			}*/
		}]
	}],
    dockedItems: [{
        xtype: 'pagingtoolbar',
        dock: 'bottom',
        displayInfo: true,
        items: [
                { 
                    xtype: 'tbseparator'
                },
                {
                    xtype : 'button',
                    text: 'Add Customer',
                    action: 'add'
                }
        ]
    }],
   /* plugins: [
              Ext.create('Ext.grid.plugin.CellEditing', {
                  clicksToEdit: 1
             })        
    ],
    selModel: {
        selType: 'cellmodel'
    },*/
    initComponent : function() {
		Ext.apply(this, {
			title : 'Ativos',
			store : 'StoreAtivos',
			
			itemSelector : 'div.post-wrap',
			tpl : new Ext.XTemplate('<tpl for=".">',
					'<div style="margin-bottom: 10px;" class="post-wrap">',
					'<h2>{title}</h2>', '<p>{content}</p>', '</div>', '</tpl>')
		});
		this.callParent(arguments);
		this.store.load();
	}
    
});